#
#
#
#
#

CC=arm-linux-gcc#
LD=arm-linux-ld#
AR=arm-linux-ar#
AS=arm-linux-as#
ASFLAGS=-EL 
LDFLAGS=-g
ARFLAGS=-r
CFLAGS=-I ../srl_include -I ../srl_include/comm -I ../srl_include/drv -I ../srl_include/head -I ../srl_include/int -I ../srl_include/kernel

vpath %.h ../srl_include
vpath %.h ../srl_include/comm
vpath %.h ../srl_include/drv
vpath %.h ../srl_include/head
vpath %.h ../srl_include/int
vpath %.h ../srl_include/kernel

BUILD_DIR=../srl_build/obj
HEAD_TAG=head.a
HEAD_OBJ=head.o 
HEAD_SRC=$(HEAD_OBJ:.o=.c)
HEAD_DEP=$(HEAD_OBJ:.o=.d)
HEAD_ASSRC=head.s 
HEAD_ASOBJ=head_asm.o

$(HEAD_TAG):$(HEAD_OBJ) $(HEAD_DEP) $(HEAD_ASOBJ)
	$(AR) $(ARFLAGS) -o $@ $(HEAD_OBJ) $(HEAD_ASOBJ)
	cp ./*.o $(BUILD_DIR)

$(HEAD_ASOBJ):$(HEAD_ASSRC)
	$(AS) $(ASFLAGS) -o $@ $< 

dep:$(HEAD_DEP)
$(HEAD_DEP):%.d:%.c
	rm -f $*.d;\
	gcc $(CFLAGS) -MM $<|sed 's,^.*:,$*.o:,' >log.$$$$1;\
	echo $(CC) $(CFLAGS) -c $< -o $*.o >log.$$$$2;\
	cat log.$$$$1 log.$$$$2|sed 's/^$(CC)/\t$(CC)/g' >$@;\
	rm -f log.$$$$*;\

include $(HEAD_OBJ:.o=.d)

clean:
	rm -f $(HEAD_DEP) $(HEAD_OBJ) $(HEAD_TAG) $(HEAD_ASOBJ)

